home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / usr / sybase / doc / dbgetoff.man < prev    next >
Text File  |  1993-04-22  |  3KB  |  111 lines

  1.  
  2.   1                       Version 4.0 -- 5/1/89                 dbgetoff
  3.   ______________________________________________________________________
  4.  
  5.   NAME:  dbgetoff
  6.  
  7.   FUNCTION:
  8.        Check for the existence of Transact-SQL constructs in the command
  9.        buffer.
  10.  
  11.   SYNTAX:
  12.        int dbgetoff(dbproc, offtype, startfrom)
  13.  
  14.        DBPROCESS *dbproc;
  15.        DBUSMALLINT offtype;
  16.        int       startfrom;
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.   dbgetoff                Version 4.0 -- 5/1/89                        2
  25.   ______________________________________________________________________
  26.  
  27.   COMMENTS:
  28.  
  29.        o If the DBOFFSET option has been set  (see  the  options  manual
  30.          page),  this  routine  can  check  for  the location of certain
  31.          Transact-SQL constructs in the command  buffer.   As  a  simple
  32.          example,  assume  the  program doesn't know the contents of the
  33.          command buffer but needs to know where the SQL  keyword  SELECT
  34.          appears:
  35.  
  36.          int        select_offset[10];
  37.          int        last_offset;
  38.          int        i;
  39.  
  40.          /* set the offset option */
  41.          dbsetopt(dbproc, DBOFFSET, "select");
  42.  
  43.          /* Assume the command buffer contains the following SELECTs */
  44.  
  45.  
  46.   3                       Version 4.0 -- 5/1/89                 dbgetoff
  47.   ______________________________________________________________________
  48.          dbcmd(dbproc, "select x = 100 select y = 5");
  49.  
  50.          /* send the query to SQL Server */
  51.          dbsqlexec(dbproc);
  52.  
  53.          /* Get all the offsets to the SELECT keyword */
  54.          for (i = 0, last_offset = 0; last_offset != -1; i++)
  55.              if ((last_offset = dbgetoff(dbproc, OFF_SELECT, last_offset))
  56.                  != -1)
  57.                  select_offset[i] = last_offset++;
  58.  
  59.          In this example, select_offset[0] = 0  and  select_offset[1]  =
  60.          15.
  61.  
  62.   PARAMETERS:
  63.        dbproc -  A pointer to the DBPROCESS structure that provides  the
  64.            connection for a particular front-end/SQL Server process.  It
  65.  
  66.  
  67.  
  68.   dbgetoff                Version 4.0 -- 5/1/89                        4
  69.   ______________________________________________________________________
  70.            contains all the information that DB-Library uses  to  manage
  71.            communications and data between the front end and SQL Server.
  72.        offtype -  The type of offset you want to find.   The  types  are
  73.            defined in the header file sybdb.h and are:
  74.  
  75.                 OFF_SELECT
  76.                 OFF_FROM
  77.                 OFF_ORDER
  78.                 OFF_COMPUTE
  79.                 OFF_TABLE
  80.                 OFF_PROCEDURE
  81.                 OFF_STATEMENT
  82.                 OFF_PARAM
  83.                 OFF_EXEC
  84.            See the options manual page for details.
  85.  
  86.        startfrom -  The point in  the  buffer  to  start  looking.   The
  87.  
  88.  
  89.  
  90.   5                       Version 4.0 -- 5/1/89                 dbgetoff
  91.   ______________________________________________________________________
  92.            command buffer begins at 0.
  93.  
  94.   RETURNS:
  95.        The character offset into the command buffer  for  the  specified
  96.        offset.  If the offset is not found, -1 is returned.
  97.  
  98.   SEE ALSO:
  99.        dbcmd, dbgetchar, dbsetopt, dbstrcpy, dbstrlen, options
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.